/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.roster;

/**
 *
 * @author hendrikdekock
 */
public class Roster {
    
    private RosterNode[] teamRost = new RosterNode[15];
    private int teamid;
    private int count;
    
    public Roster(int team) {
        teamid = team;
        count = 0;
    }
    
    public int rosterCount() {
        return count;
    }
    
    public void addNode(int pid, int posId, boolean act) {
        teamRost[count] = new RosterNode(pid, posId, act);
        count++;
    }
    
    public int getTeamid() {
        return teamid;
    }
    
    public RosterNode getNode(int i) {
        return teamRost[i];
    }
    
    public int getPlayerId(int i) {
        return teamRost[i].getPlayerId();
    }
    
    public int getPos(int i) {
        return teamRost[i].getPos();
    }
    
    public int numBenched() {
        int benchCount = 0;
        for (int i = 0; i < teamRost.length; i++) {
            if (teamRost[i].getActive())
                benchCount++;
        }
        return benchCount;
    }
    
    public int getPosCount(int pos) {
        int posCount = 0;
        for (int i = 0; i < teamRost.length; i++) {
            if (teamRost[i].getPos() == pos)
                posCount++;
        }
        return posCount;
    }
    
    public void toggleActive(int i) {
        teamRost[i].toggleActive();
    }
}
